<?php 
class newsComponents extends  sfComponents
{
	public function executeLastnews()
	{
		
		$howmuch = isset($this->howmuch)? $this->howmuch : 5 ;  
		
		$query = Doctrine_Query::create() //Doctrine::getTable('Article')->createQuery()  для кодировки
			->from('news')
			->orderBy('news.updated_at DESC')
			->limit($howmuch);
		$this->news = $query->execute();
		
		$query = Doctrine_Query::create() //Doctrine::getTable('Article')->createQuery()
			->from('news')
			->orderBy('news.updated_at DESC')
			->where('news.is_ukraine=1')
			->limit($howmuch);
		$this->news_ukr = $query->execute();
	}

	public function executeBytag()
	{
		$this->news = News::getByTags($this->tags, $this->id, $this->limit);
	}
}
?>